<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');

class Sale extends MX_Controller {

	public function __construct() {
		parent::__construct();

		$this->template->set_layout('sale');
		$this->template->set_partial('header_search', 'header/header_search');
		$this->template->set_partial('nav_bar', 'header/nav_bar');
		$this->load->model('member/member_model');
		$this->load->model('member/profile_model');
		$this->load->model('member/sale_model');
		$this->load->model('location/location_model');
		
	}

	public function index(){
		$data['mode'] = "SALE";

		
		
		$isProfile = $this->profile_model->getProfileByMemberID($this->session->userdata('mem_id'));
		if($isProfile){
			$data['profile']['info'] = $isProfile;
		}else{
			$data['profile']['info'] = NULL;
		}
		
		$data['state']['all'] = $this->location_model->getStates();


		$this->template->build('sale',$data);
	}

	
	
	
	function detail()
	{
		
		$data['mode'] = "DETAIL";
		$id = $this->commoncall->get_id(current_url());
		
		$sql = "select * from sale where id=$id and status=51";
		$result = $this->db->query($sql)->row();
		
		$data['sale']['info'] = $result;
		$this->template->build('detail',$data);
	}
	
	
}